#                                               -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.

AC_PREREQ(2.59)
AC_INIT(pam_passwdgrub, 0.0.2, [https://gna.org/projects/pam-passwdgrub/])
AC_CONFIG_SRCDIR([grub_md5/shared.h])
AC_CONFIG_HEADER([config.h])
AM_INIT_AUTOMAKE(pam_passwdgrub, 0.0.2)

# Checks for programs.
AC_PROG_CC
AC_DISABLE_STATIC
AC_PROG_LIBTOOL

# Checks for libraries.
# FIXME: Replace `main' with a function in `-lpam':
AC_CHECK_LIB([pam], [main])

PKG_CHECK_MODULES(GLIB, glib-2.0 >= 2.4.7)
AC_SUBST(GLIB_CFLAGS)
AC_SUBST(GLIB_LIBS)

AC_ARG_ENABLE(debug,
	      [AC_HELP_STRING([--enable-debug],
			     [enable debug mode [default=no]])],,
	      [enable_debug=no])

if test "x$enable_debug" = "xyes"; then
  CFLAGS="$CFLAGS -DPGDEBUG -Wall -O0 -g -ggdb3"
fi

# Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS([fcntl.h string.h unistd.h])

# Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST

# Checks for library functions.
AC_FUNC_CHOWN
AC_CHECK_FUNCS([memset strstr])

AC_CONFIG_FILES([Makefile
                 src/Makefile])
AC_OUTPUT
